package net.qhzw.vip.qiyu.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.qhzw.vip.qiyu.model.LoginResult;
import net.qhzw.vip.qiyu.result.JsonResult;
import net.qhzw.vip.qiyu.service.OauthLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RequestMapping("oauth/login")
@RestController
@Api(tags = "登录的控制器")
public class OauthLoginController {


    @Autowired
    private OauthLoginService oauthLoginService;

    @PostMapping
    @ApiOperation(value = "人员登录")
    private JsonResult<LoginResult> login(@RequestBody Map<String, String> param) {
        String loginType = param.get("loginType");
        String username = param.get("username");
        String password = param.get("password");
        LoginResult login = oauthLoginService.login(username, password, loginType);
        return JsonResult.ok(login);
    }


}
